import { Tools } from 'weaver-mobile';
import DocConstant from '../util/index';

const catchApiError = DocConstant.catchApiError;

//获取高级搜索条件
export const getCondition = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/searchListCondition', method: 'GET', params}).then(catchApiError);

//获取搜索历史列表
export const getHistoryList = params =>
    Tools.callApi({url: '/api/networkdisk/clouddisk/getHistorySearch', method: 'GET', params}).then(catchApiError);

//清空搜索历史列表
export const clearSearchHistory = params =>
    Tools.callApi({url: '/api/networkdisk/clouddisk/clearHistory', method: 'GET', params}).then(catchApiError);


// 全部文档列表
export const getAllDocList = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getAllDocList', method: 'GET', params}).then(catchApiError);

// 我的文档列表
export const getMyDocList = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getMyDocList', method: 'GET', params}).then(catchApiError);

// 我的收藏列表
export const getCollectDocList = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getCollectDocList', method: 'GET', params}).then(catchApiError);
// 初始数据
export const init = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/categoryBrowser', method: 'GET', params}).then(catchApiError);
export const getCategoryList = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getCategoryList', method: 'GET', params}).then(catchApiError);
export const getMyCategoryList = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getMyCategoryList', method: 'GET', params}).then(catchApiError);
export const getCategoryDocList = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getCategoryDocList', method: 'GET', params}).then(catchApiError);

export const getUserAndCategory = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/userAndCategory', method: 'GET', params}).then(catchApiError);

export const getCategoryParamCondition = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/getParams', method: 'GET', params}).then(catchApiError);

export const getMouldContent = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/getMouldContent', method: 'GET', params}).then(catchApiError);

export const isExists = (params) =>
  Tools.callApi({url: '/api/doc/save/isExists', method: 'GET', params}).then(catchApiError);

export const save = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/save', method: 'POST', params}).then(catchApiError);


export const afterSave = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/afterSave', method: 'GET', params}).then(catchApiError);

export const shareList = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/shareList', method: 'GET', params}).then(catchApiError);

export const shareCanEdit = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/canEdit', method: 'GET', params}).then(catchApiError);
export const getShareCondition = (params) =>
  Tools.callApi({url: '/api/doc/share/addShare', method: 'GET', params}).then(catchApiError);
export const deleteShare = (params) =>
  Tools.callApi({url: '/api/doc/share/deleteShare', method: 'GET', params}).then(catchApiError);
export const saveShare = (params) =>
  Tools.callApi({url: '/api/doc/share/saveShare', method: 'POST', params}).then(catchApiError);
//获取新建文档时的默认目录
export const getDefaultCategory = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/getdefaultfolder', method: 'GET', params}).then(catchApiError);
//保存当前用户选择的tab以及viewmode
export const saveChooseTab = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/setchoosetab', method: 'POST', params}).then(catchApiError);
//获取用户的tab以及mode
export const getChooseTab = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/getchoosetab', method: 'GET', params}).then(catchApiError);
//获取新建类型
export const getCreateDocType = (params) =>
	Tools.callApi({url: '/api/doc/mobile/systemDoc/getCreateDocType', method: 'POST', params}).then(catchApiError);
export const getDocFileEdit = (params) =>
	Tools.callApi({url: '/api/doc/mobile/systemDoc/getDocFileEdit', method: 'POST', params}).then(catchApiError);
export const saveOffice = (params) =>
	Tools.callApi({url: '/api/doc/mobile/systemDoc/saveOffice', method: 'POST', params}).then(catchApiError);
  